﻿package Welsy4.Connect.vo
{
	
	/**
	 * ...
	 * @param DefaultUser (Tools -> Custom Arguments...)
	 */
	public class User 
	{
		public static var HOST:String = "host";
		public static var MINI_HOST:String = "mini-host";
		public static var VIEW:String = "view";
		
		public var nickname:String; // login
 		public var permission:String = VIEW; // host, mini-host or view
		public var validUser:Boolean = false;
		
		public var nome:String = "";
		public var cognome:String = "";
		
		public var account_id:String;
		public var principal_id:String;
		
		public var isAdministrator:Boolean = false;
		
		private var password:String;
		
		
		public function User(nickname:String) 
		{
			this.nickname = nickname;
			this.password = generatePassword(nickname);
		}
		
		
		public static function generatePassword(nickname:String):String {
		    var p:String = nickname+""+nickname;
			
			if (p.length > 32) {
				p = p.substr(0, 30);
			}
			return p; 
		}
		
		public static function getLoginRequestlocaleTime():String {
            var now:Date = new Date();
			return now.toLocaleString();
			
		}
		public function setPassword(password:String):void {
		    this.password = password;
		}
		public function getPassword():String {
		    return this.password;
		}
		
	}
	
}